/****************************************************************/
/*  I M P E T U S     C O P Y R I G H T      S T A T E M E N T  */
/****************************************************************/
/*                                                              */
/*  NOTICE: THIS SOFTWARE CONTAINS TRADE SECRETS THAT BELONG TO */
/*          IMPETUS INFOTECH, AND IS LICENSED BY AN AGREEMENT.  */
/*          ANY UNAUTHORIZED ACCESS, USE, DUPLICATION OR        */
/*          DISCLOSURE IS UNLAWFUL.                             */
/*                                                              */
/*          COPYRIGHT (C) 2008 IMPETUS INFOTECH INDIA PVT LTD   */
/*          ALL RIGHTS RESERVED.                                */
/****************************************************************/


package com.iLabs.spice.handler;

import com.iLabs.pagecode.PageCodeBase;
import com.iLabs.spice.beans.ProfileBean;

public class OwnerProfileHandler extends PageCodeBase{
	
	/**
	 * This method update current profile with owner and link with current profile.
	 * @return String 
	 */
	
	public String linkMyProfile() {		
		updateCurrentProfileWithOwner();		
		return "lnkMyProfile";
	} 
	
	/**
	 * This method update current profile with owner and link with current profile and 
	 * display current friends List.
	 * @return String.
	 */
	
	public String linkViewAllFriends() {		
		updateCurrentProfileWithOwner();		
		return "lnkViewAllFriends";
	} 
	
	/**
	 * This method update current profile with owner and link with current profile.
	 * @return String.
	 */
	public String getOwnerProfile() {		
		updateCurrentProfileWithOwner();		
		return "lnkHome";
	}  
	
	/**
	 * This method update current profile with owner and link with current profile.
	 */
	public void updateCurrentProfileWithOwner()
	{
		
		ProfileBean ownerProfile = (ProfileBean)getSessionScope().get("ownerProfile");
			if (ownerProfile != null ) {
				ProfileBean currentProfile =(ProfileBean) getSessionScope().get("currentProfile");
				currentProfile.setUserAuth(ownerProfile.getUserAuth());							
				currentProfile.setUserFriends(ownerProfile.getUserFriends());
				getSessionScope().put("currentProfile", currentProfile);
			}
	}
}
